package com.web.servlet;

import com.web.entity.Student;
import com.web.service.StudentService;
import com.web.serviceimpl.StudentServiceImpl;
import com.web.util.GsonUtil;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 根据学号/姓名查询学生信息
 * @author 12270
 */
@WebServlet("/sosms")
public class SearchOneStudentMessageServlet extends HttpServlet{
    
    StudentService studentService = new StudentServiceImpl();
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        String keyword=req.getParameter("keyword");

        
        Student s= studentService.findStudentBykeyword(keyword);

        resp.setContentType("application/x-json;charset=utf-8");
        String jsonObject = GsonUtil.javatoJson(s);
        resp.getWriter().println(jsonObject);
        System.out.println(jsonObject);
        
    }
}
